<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<c:forEach items="${resume.educationList}" var="education">
        <c:if test="${!empty education}">
            <div class="exper_info">
                <span><b>${education.schoolName}</b></span>
                <span>&nbsp|&nbsp</span>
                <span class="edu_time"><fmt:formatDate value="${education.startDate}" pattern="yyyy/MM/dd"/>-<fmt:formatDate
                        value="${education.endDate}" pattern="yyyy/MM/dd"/></span></br>
                <span><b>${education.major}</b></span>
                <span>&nbsp|&nbsp</span>
                <span><b>${education.degree}</b></span></br>
                <span>${education.experienceSchool}</span>
                <div class="button_edit">
                    <button type="button" value="${education.id}"  id="button_edu_edit_${education.id}"
                            onclick="edit(this.value)">编辑</button>
                </div>
                <div class="button_del">
                    <button type="button" value="${education.id}" id="button_edu_del_${education.id}"
                            onclick="del(this.value)">删除</button>
                </div>
            </div>
        </c:if>
</c:forEach>
<script>
    function edit(obj) {
        // console.log("教育经历id:"+obj);
        $("#edu_edit").load("/hire/resume/edu_edit_update",{id:obj});
        $("#edu_info").hide();
        $("#edu_edit").show();
    }
    function del(obj) {
        $.post('/hire/resume/education/delete',{educationId:obj},function (res) {
            if (res.code == '200') {
                let resumeId = $("#resumeId").val();
                $("#edu_info").load("/hire/resume/edu_info", {id: resumeId});
                $("#edu_edit").hide();
            } else {
                layer.msg(res.msg);
            }
        })
    }
    <%--console.log(button_edu_edit_${education.id})--%>
    <%--$("#button_edu_edit_${education.id}").click(function () {--%>
    <%--    console.log(button_edu_edit_${education.id})--%>
    <%--    let resumeId = $("#resumeId").val();--%>
    <%--    $("#edu_edit").load("/hire/resume/edu_edit", {id: resumeId});--%>
    <%--    $("#edu_info").hide();--%>
    <%--    $("#edu_edit").show();--%>
    <%--})--%>
    // $("#button_edu_del").click(function () {
    //     let resumeId = $("#resumeId").val();
    //     let educationId = $("#educationId").val();
    //
    //     $.post('/hire/resume/education/delete',{"educationId":educationId,"id":resumeId},function (res) {
    //         if (res.code == '200') {
    //             $("#edu_info").load("/hire/resume/edu_info", {id: resumeId});
    //             $("#edu_info").remove();
    //             $("#edu_edit").hide();
    //         } else {
    //             layer.msg("删除失败")
    //         }
    //     })
    //
    // })
</script>